﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace MINERP.CustomerManage.PickupPhoto
{
    public partial class FrmSetUser : Form
    {
        //属性
        public FrmDisposeMain frm;
        public int UserId;                  //选中的UserId
        public DataTable UserDt;            //员工集合

        public FrmSetUser()
        {
            InitializeComponent();
        }

        private void FrmSetUser_Load(object sender, EventArgs e)
        {
            try
            {
                cbUsers.DisplayMember = "UserName";
                cbUsers.ValueMember = "UserId";
                cbUsers.DataSource = UserDt;
                cbUsers.SelectedValue = UserId;
                lblStartOrder.Text = cbUsers.Text.Trim();
                btnOk.Focus();
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "确定", MessageBoxButtons.OK, MessageBoxIcon.Warning);
            }
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            frm.SelectedUserId = Convert.ToInt32(cbUsers.SelectedValue);
            frm.SelectedUserName = cbUsers.Text.Trim();
            DialogResult = DialogResult.OK;
            this.Close();
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //选择员工
        private void cbUsers_SelectedIndexChanged(object sender, EventArgs e)
        {
            lblStartOrder.Text = cbUsers.Text.Trim();
        }
    }
}
